<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>系统日志管理页面</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/js/jquery-1.8.3.js"></script>
</head>
<body>
<div>
    <label class="layui-form-label">日志记录</label>
    <div class="layui-input-inline">
        <input type="text" name="name1" required  lay-verify="required" placeholder="用户名/用户操作" autocomplete="off" class="layui-input">
    </div>
    <button class="layui-btn layui-btn-radius" id="ch">查询</button><br>
</div>

<table id="demo" lay-filter="tableFilter"></table>

<script src="${pageContext.request.contextPath}/layui/layui.js"></script>

<script>

    layui.use(['table','form','layer','jquery'], function(){
        var table = layui.table;
        var form=layui.form;
        var layer=layui.layer;
        var $=layui.jquery;
        table.render({
            elem: '#demo'
            ,height: 312
            ,url:'${pageContext.request.contextPath}/log/selectAll' //数据接口
            ,page: true //开启分页
            ,limit: 10
            ,limits:[10,20]
            ,cols: [[ //表头
                {field: 'logId', title: 'ID', width:80, sort: true, fixed: 'left'}
                ,{field: 'username', title: '用户名', width:80}
                ,{field: 'logIp', title: 'ip', width:150, sort: true}
                ,{field: 'logType', title: '类型', width:80, sort: true}
                ,{field: 'logContent', title: '日志内容', width:150, sort: true}
                ,{field: 'logDate', title: '日志日期', width:300, sort: true}
                ,{field: 'logMethod', title: '操作方法', width:500}
                ,{field: 'logTime', title: '运行时间', width:100, sort: true}

            ]]

        });

        //---条件查询 start----
        $("#ch").click(function () {
            console.info(111111);
            table.reload('demo', {
                where: { //设定异步数据接口的额外参数，任意设
                    username: $("[name=name1]").val()
                }
                ,page: {
                    curr: 1 //重新从第 1 页开始
                }
            }); //只重载数据

        });






    })

</script>
</body>
</html>